﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace AircraftBattleServer
{
    [Serializable]
    public class MyPoint
    {
        public double x;
        public double y;

        public MyPoint(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
    };

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IGameEngineService" in both code and config file together.
    [ServiceContract]
    public interface IGameEngineService
    {
        [OperationContract]
        MyPoint GetPosition(int id);

        [OperationContract]
        MapData GetMapData();

        [OperationContract]
        double GetConstant(int choice);

        [OperationContract(IsOneWay=true)]
        void SetPosition(int craftId, double left, double top);

        [OperationContract(IsOneWay=true)]
        void SetAngle(int craftId, double angle);

        [OperationContract]
        void AddAircraft(int id, MyPoint p, double angle);

        [OperationContract]
        void RemoveAircraft(int id);

        [OperationContract(IsOneWay = true)]
        void AddMissile(string id, double x, double y, double angle);

        [OperationContract]
        bool IfUserExist(string username);

        [OperationContract]
        bool IsAdmin(string username);

        [OperationContract]
        string CreateUser(string username);

        [OperationContract]
        string GetPassword(string username);

        [OperationContract]
        int GetAircraftID(string username);

        [OperationContract]
        void AddPlayer(string username, int craftID);

        [OperationContract]
        void SetTeam(string username, int team);

        [OperationContract]
        void SetReady(string username, int ready);

        [OperationContract]
        void DeletePlayer(string username,int craftID);

        [OperationContract]
        void InitializePosition();

        [OperationContract]
        int GetWinRecord(string username);

        [OperationContract]
        int GetLoseRecord(string username);

        [OperationContract(IsOneWay = true)]
        void StartGame();

        [OperationContract]
        void AddWinRecord(string username);

        [OperationContract]
        void AddLoseRecord(string username);

        [OperationContract]
        void AddKillRecord(string username);

        [OperationContract]
        bool GetBlockInfo(string username);

        [OperationContract]
        void SetBlockInfo(string username, bool blocked, string commander, string password);

        [OperationContract]
        int GetMaxUserID();

        [OperationContract]
        string GetUserName(int id);

    }
}
